package com.bo.baby2.config;

import java.io.Serializable;

/**
 * @program: baby2_p2p
 * @description: 返回结果类
 * @author:波
 * @create: 2020-07-12 14:38
 **/

public class ReturnResult implements Serializable {

    private static final long serialVersionUID = -955856642506237771L;
    private  String code;       //返回状态编码
    private  String msg;     //返回提示消息
    private Object data;        //响应的数据

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public ReturnResult(){}
    public ReturnResult(String code,String msg,Object data){
        this.code=code;
        this.msg=msg;
        this.data=data;
    }

    /**
     * 结果成功时
     * @param msg
     * @return
     */
    public static ReturnResult successResult(String msg,Object data){
        return new ReturnResult("200",msg,data);
    }

    /**
     * 失败时
     * @param msg
     * @return
     */
    public static ReturnResult failResult(String msg){
        return new ReturnResult("500",msg,null);
    }
}
